/**
* 系统设置路由
**/
'use strict';
import gaikuangaCtl from './gaikuanga'
import permissionsCtl from './permissions'

import interfacesCtl from './interfaces'

import operalogCtl from './operalog'
/*全局设置系统设置*/
import systemCtl from './system'
/*全局设置参数设置*/
import datasetCtl from './dataset'
/*全局设置版本管理*/
import releaseCtl from './release'
/*权限设置管理员*/
import setadminCtl from './setadmin'
/*权限设置管理组*/
import setgroupCtl from './setgroup'
/*权限设置添加管理组*/
import addgroupCtl from './addgroup'


module.exports = angular.module('app.datas', []).config(function($stateProvider) {
    $stateProvider.state('datas', {
        url: '/datas',
        templateProvider: function($q) {
            var deferred = $q.defer();
            require.ensure(['../layout.html'], function(require) {
                var template = require('../layout.html');
                deferred.resolve(template);
            }, 'datas-tpl');
            return deferred.promise;
        },
        controller: 'datasCtrl',
        controllerAs: 'vm',
        resolve: {
            'app.index': function($q, $ocLazyLoad) {
                var deferred = $q.defer();
                require.ensure(['./index.js'], function() {
                    var mod = require('./index.js');
                    $ocLazyLoad.load({
                        name: 'app.datas'
                    });
                    deferred.resolve(mod.controller);
                }, 'datas-ctl');
                return deferred.promise;
            }
        }
    })
    .state('datas.gaikuanga', {
        url: '/gaikuanga',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./gaikuanga/index.html'], function(require) {
                        var template = require('./gaikuanga/index.html');
                        deferred.resolve(template);
                    }, 'datas.gaikuanga-tpl');
                    return deferred.promise;
                },
                controller:gaikuangaCtl
            }
        }
    })
    /*.state('datas.system', {
        url: '/global/system?id',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./global/index.html'], function(require) {
                        var template = require('./global/index.html');
                        deferred.resolve(template);
                    }, 'datas.global-tpl');
                    return deferred.promise;
                },
                controller:globalCtl
            }
        }
    })*/
    .state('datas.dataset', {
        url: '/global/dataset?id',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./dataset/index.html'], function(require) {
                        var template = require('./dataset/index.html');
                        deferred.resolve(template);
                    }, 'datas.dataset-tpl');
                    return deferred.promise;
                },
                controller:datasetCtl
            }
        }
    })
    .state('datas.release', {
        url: '/global/release?id',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./release/index.html'], function(require) {
                        var template = require('./release/index.html');
                        deferred.resolve(template);
                    }, 'datas.release-tpl');
                    return deferred.promise;
                },
                controller:releaseCtl
            }
        }
    })
    .state('datas.permissions', {
        url: '/permissions',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./permissions/index.html'], function(require) {
                        var template = require('./permissions/index.html');
                        deferred.resolve(template);
                    }, 'datas.permissions-tpl');
                    return deferred.promise;
                },
                controller:permissionsCtl
            }
        }
    })
    .state('datas.setadmin', {
        url: '/permissions/setadmin?id',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./permissions/index.html'], function(require) {
                        var template = require('./permissions/index.html');
                        deferred.resolve(template);
                    }, 'datas.permissions-tpl');
                    return deferred.promise;
                },
                controller:permissionsCtl
            }
        }
    })
    .state('datas.setgroup', {
        url: '/permissions/setgroup?id',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./setgroup/index.html'], function(require) {
                        var template = require('./setgroup/index.html');
                        deferred.resolve(template);
                    }, 'datas.setgroup-tpl');
                    return deferred.promise;
                },
                controller:setgroupCtl
            }
        }
    })
    .state('datas.addgroup', {
        url: '/permissions/setgroup/addgroup?id?ids?state',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./addgroup/index.html'], function(require) {
                        var template = require('./addgroup/index.html');
                        deferred.resolve(template);
                    }, 'datas.addgroup-tpl');
                    return deferred.promise;
                },
                controller:addgroupCtl
            }
        }
    })
    .state('datas.interfaces', {
        url: '/interfaces?state',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./interfaces/index.html'], function(require) {
                        var template = require('./interfaces/index.html');
                        deferred.resolve(template);
                    }, 'datas.interfaces-tpl');
                    return deferred.promise;
                },
                controller:interfacesCtl
            }
        }
    }).state('datas.operalog', {
        url: '/operalog',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./operalog/index.html'], function(require) {
                        var template = require('./operalog/index.html');
                        deferred.resolve(template);
                    }, 'datas.operalog-tpl');
                    return deferred.promise;
                },
                controller:operalogCtl
            }
        }
    })
}).name;
